function disable_btns(){
    $("#reg").attr("disabled",true);
    $("#cancel_user").attr("disabled",true);
}

function able_btns(){
    $("#reg").removeAttr("disabled");
    $("#cancel_user").removeAttr("disabled");
}


$("#cancel_user").click(function(){
    if($("#cancel_phone").val()!=''){
        $.ajax({
            url: '/Reg/ajax_cancel_user',
            async:false,
            type: 'post',
            dataType: 'json',
            data: { 'cancel_phone': $('#cancel_phone').val(),'_token':$('input[name=_token]').val()},
            beforeSend:function(){
                disable_btns();
                $("#cancel_info").empty();
                 $("#cancel_info").html('正在进行，请稍候');
            },
            success:function(d){
                able_btns();
                if(d.status==1){
                    
                    $("#cancel_info").empty();
                    $("#cancel_info").html(d.data.info);
                    
                }else{
                   $("#cancel_info").empty();
                   $("#cancel_info").html('处理失败');
                }
            },
            error:function(){
                able_btns();
                $("#cancel_info").empty();
                $("#cancel_info").html('处理失败，请重试');
            }
        });
    }
    
    
    
});
